
class Circle():
    PI = 3.1215926  #类的属性
    def __init__(self,r):
        self.r = r   #实例对象的属性

    def area(self):
        self.__area = Circle.PI *(self.r * self.r)
        print(f'圆的面积为：{self.area}')
    def perimeter(self):
        self.perimeter = Circle.PI*(2*self.r)
        print(f'圆的周长为：{self.perimeter}')

circle1 = Circle(2)
circle1.area()
# circle1.perimeter()
#
# print (circle1.area)
print(circle1.__dict__)
print (circle1._Circle__area)
# print (circle1.area)
#
#
# circle2 = Circle(3)
# circle2.area()
# circle2.perimeter()
Circle.PI = 4
print (Circle.PI)


